package com.liesheng.haylou.view.dialog;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.liesheng.haylou.R;
import com.liesheng.haylou.utils.DeviceUtil;

/**
 * Date:2019/12/16
 * <p>
 * Author:wuzhiguang
 * <p>
 * Description:
 */
public class ProgressBarDialog extends BaseDialog {

    private TextView tv_msg;

    public ProgressBarDialog() {
        setSize(DeviceUtil.dip2px(120), DeviceUtil.dip2px(120));
        setOutCancel(false).setCancelable(true);
//        msg = getContext().getString(R.string.loading);
    }


    private String msg = "加载中...";

    @Override
    public int setUpLayoutId() {
        return R.layout.dialog_loading;
    }

    public ProgressBarDialog setMsg(String msg) {
        this.msg = msg;
        if (tv_msg!=null)
            tv_msg.setText(msg);
        return this;
    }

    @Override
    public void convertView(ViewHolder holder, BaseDialog dialog) {
        tv_msg = holder.getView(R.id.tv_msg);
        if (!TextUtils.isEmpty(msg)) {
            tv_msg.setText(msg);
            tv_msg.setVisibility(View.VISIBLE);
        } else {
            tv_msg.setVisibility(View.GONE);
        }

    }
}
